<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>班级管理</title>
</head>
<body>
<div>
    <div>
        <h1>班级管理</h1>
        <button>新增</button>
    </div>
    <div>
        <form th:action="@{classes/search}" method="get">
            <div>
                <label>班级名称</label>
                <input type="text" th:value="${id}" name="id" placeholder="请输入班级名称（全称）">
            </div>
            <button type="submit">查询</button>
        </form>
    </div>
    <div>
        <table>
            <thead>
            <tr>
                <th>班级名称</th>
                <th>课程名称</th>
                <th>类型</th>
                <th>教师</th>
                <th>开课日期</th>
                <th>结课日期</th>
                <th>成绩最后提交日期</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="clazz:${classes}">
                <td th:text="${clazz.classId}"></td>
                <td th:text="${clazz.course?.course_name}"></td>
                <td th:text="${clazz.classType}"></td>
                <td th:text="${clazz.teacher?.username}"></td>
                <td th:text="${#dates.format(clazz.startDate, 'yyyy-MM-dd')}"></td>
                <td th:text="${#dates.format(clazz.endDate, 'yyyy-MM-dd')}"></td>
                <td th:text="${#dates.format(clazz.scoreSubmitDeadline, 'yyyy-MM-dd')}"></td>
                <td>
                    <button> 修改</button>
                    <a th:href="@{classes/{id}(id=clazz.classId)}" methods="delete">删除</a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>